﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using GPS.ENTITYS;
using GPS.COMMON;

namespace GPS.Controllers.GPS_BaoCao
{
    public class GPS_ExportOpendoorController : Controller
    {
        //
        // GET: /GPS_ExportOpendoor/
        public ActionResult Index()
        {
            GPS_EXPORT_OPENDOOR _export = new GPS_EXPORT_OPENDOOR();
            _export.MA = "0001";
            _export.TEN = "Tên 001";
            _export.NGAY = "26/03/2017";
            _export.LIST_1 = new List<GPS_EXPORT_OPENDOOR>
            {
                new GPS_EXPORT_OPENDOOR(){MA="0002",TEN="Tên 0002"},
                new GPS_EXPORT_OPENDOOR(){MA="0003",TEN="Tên 0003"},
                new GPS_EXPORT_OPENDOOR(){MA="0004",TEN="Tên 0004"},
                new GPS_EXPORT_OPENDOOR(){MA="0005",TEN="Tên 0005"},
                new GPS_EXPORT_OPENDOOR(){MA="0006",TEN="Tên 0006"}

            };

            byte[] contentFile = null;
            string contentType = "application/msword";

            contentFile = GPS.ENTITYS.EXPORTWORD_OPENDOOR.EXPORT_OPENDOOR(Server.MapPath("~/Templates/GPS_Word/Opendoor.docx"), _export, "DocxGenericReport");
            string nameOutput = "EXPORT_OPENDOOR_" + DateTime.Now.ToShortDateString() + ".docx";


            return File(contentFile, "application/vnd.openxmlformats-officedocument.wordprocessingml.document", nameOutput);

        }
    }
}